<?php

class WidgetFormPertinencia extends sfWidgetForm
{
	
	public function configure($options = array(), $attributes = array())
	{
		$url = sfContext::getInstance()->getController()->genUrl('pertinencia/buscar');
		$this->addOption('template',
<<<EOF

<input type="text" id="pertinencia_tema" style="width:260px">
<input type="button" id="btnBuscar" value="Buscar pertinencias">
<input type="hidden" id="url_pertinencia" value="$url">
<input type="hidden" id="pertinencia_id" name="{name}">
<br>
<br>
<table id="resultados" style="visibility: hidden" class="form_table">
  <thead>
    <tr>
      <th></th>
      <th>Tema</th>
      <th>Aprobado</th>
      <th>F. Solicitud</th>
    </tr>
  </thead>
  <tbody>
  </tbody>
</table>

EOF
		);
	}

	public function getJavaScripts()
	{
		return array('/js/pertinencia.js');
	}
	
	public function render($name, $value = null, $attributes = array(), $errors = array())
	{
		$template_vars = array();
		$template_vars['{name}'] = $name;
		return strtr($this->getOption('template'), $template_vars);
	}

}
